//
//  CrossTwoTypesStyle.cpp
//  fingeradvanture
//
//  Created by shuaibincheng on 16/5/29.
//
//

#include "CrossTwoTypesStyle.hpp"
#include "Utils.hpp"
MonsterType CrossTwoTypesStyle::next()
{
    if(verticality == MONSTER_UNKNOWN || horizontal == MONSTER_UNKNOWN)
    {
        auto verticalTypes = allowMonsterTypesInVetical();
        auto horizontalTypes = allowMonsterTypesInHorizontal();
        
        auto index = Utils::random_int(verticalTypes.size());
        verticality = verticalTypes[index];
        
        index = Utils::random_int(horizontalTypes.size());
        horizontal = horizontalTypes[index];
    }
    
    if(remaining < 2)
    {
        return verticality;  //最后两个怪物放置在垂直方向上
    }
    else
    {
        return horizontal; //其余的放在水平方向上
    }
    return MONSTER_UNKNOWN;
}

std::vector<MonsterType> CrossTwoTypesStyle::allowMonsterTypesInVetical()
{
    std::vector<MonsterType> types;
    types.push_back(MONSTER_4_3);
    return types;
}

std::vector<MonsterType> CrossTwoTypesStyle::allowMonsterTypesInHorizontal()
{
    std::vector<MonsterType> types;
    types.push_back(MONSTER_4);
    types.push_back(MONSTER_5);
    return types;
}